SHELL	:=/bin/bash
TARGET  := cilantro
SRCS    := cfgengine.c check.c cilantro.c component.c component_group.c creditcard.c hardware.c order.c sql.c
OBJS    := ${SRCS:.c=.o} 
DEPS    := ${SRCS:.c=.dep} 
INCLUDES:= -I./../include
CC		:= gcc
CFLAGS  := -c -Wall

CCFLAGS = -std=gnu99 -O2 -Wall -Werror -ggdb 
LDFLAGS = 
LIBS    = 

.PHONY: all clean distclean 

all: ${OBJS}

check.o: check.c
	${CC} ${INCLUDES} ${CFLAGS} check.c -o check.o

cilantro.o: cilantro.c
	${CC} ${INCLUDES} ${CFLAGS} cilantro.c -o cilantro ${OBJS}

component.o: component.c
	${CC} ${INCLUDES} ${CFLAGS} component.c -o component.o

component_group.o: component_group.c
	${CC} ${INCLUDES} ${CFLAGS} component_group.c -o component_group.o

creditcard.o: creditcard.c
	${CC} ${INCLUDES} ${CFLAGS} creditcard.c -o creditcard.o

hardware.o: hardware.c
	${CC} ${INCLUDES} ${CFLAGS} hardware.c -o hardware.o

order.o: order.c
	${CC} ${INCLUDES} ${CFLAGS} order.c -o order.o

sql.o: sql.c
	${CC} ${INCLUDES} ${CFLAGS} sql.c -o sql.o `pkg-config --libs sqlite` 

cfgengine.o: cfgengine.c
	${CC} ${INCLUDES} ${CFLAGS} cfgengine.c -o cfgengine.o `pkg-config --libs libconfig` 

clean:
	-rm -f *~ *.o ${TARGET} 
